package com.beauty.payment;

import com.beauty.payment.client.OrderClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class PaymentApplication {
    
    /**
     * 当OrderClient无法注入时使用的mock实现
     */
    @Bean
    public OrderClient orderClientMock() {
        return new OrderClient() {
            @Override
            public Object updateOrderStatus(Long id, String status) {
                System.out.println("使用Mock实现更新订单状态: ID=" + id + ", status=" + status);
                return null;
            }
            
            @Override
            public Object updateOrderStatusByOrderNumber(String orderNumber, String status) {
                System.out.println("使用Mock实现通过订单号更新订单状态: orderNumber=" + orderNumber + ", status=" + status);
                return null;
            }
        };
    }
    
    public static void main(String[] args) {
        SpringApplication.run(PaymentApplication.class, args);
    }
} 